package temp;

import java.util.Hashtable;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.spi.NamingManager;

import org.junit.Assert;
import org.junit.Test;

public class WhTest {//extends TestCase

	static {

	}

	public WhTest(String name) {
		//		super(name);
		System.out.println(name);
	}

	public WhTest() {
	}

	@Test(timeout = 6000)
	//expected = BusinessException.class
	public void testA() {
		//		if(1==1){
		//			throw new BusinessException();
		//		}
		//		assertTrue(1==1);
		try {
			Thread.sleep(1000 * 1);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		System.out.println("run testA");
	}

	@Test
	public void testB() {
		System.out.println("run testB");
	}

	@Test()
	public void aa() {
		System.out.println("run aa");
		Assert.assertTrue(1 == 1);
	}

	@Test()
	public void testJndi1() {
		try {
//			Hashtable env = new Hashtable();
//			env.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.naming.java.javaURLContextFactory");
//			env.put(Context.PROVIDER_URL, "java:://localhost:8080");
//			InitialContext ctx = new InitialContext(env);
//			Context cxt = new InitialContext();
//			cxt.bind("myname", "yahoo");
//			System.out.println(" run testJndi1");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	@Test()
	public void testJndi2() {
		try {
			//			Context cxt = NamingManager.getInitialContext(null);
			//			Object lookup = cxt.lookup("myname");
			//			System.out.println(lookup);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	@Test()
	public void test5() {
		int[] a = { 3, 5, 9, 7, 4, 13, 15, 0, 2, 20 };
		boolean[] b = new boolean[21];
		for (int i = 0; i < a.length; i++) {
			b[a[i]] = true;
		}
		for (int i = 0; i < b.length; i++) {
			if (b[i]) {
				System.out.print(i + ",");
			}
		}
	}
	
	@Test
	public void testNumberEquals(){
		boolean equals = new Long(1).equals(new Integer(1));
		System.out.println(equals);
		Assert.assertTrue(equals);
	}

}
